package com.wu.multiply;

/**
 * 构件乘积数组
 * @author lynn
 * @date 2020/8/18 - 16:41
 */
public class Solution {
    public int[] multiply(int[] A) {
        if (A == null || A.length == 0){
            return null;
        }
        int[] B = new int[A.length];
        int temp = 0;
        for (int i = 0; i < A.length; i++) {
            temp = A[i];
            A[i] = 1;
            B[i] = 1;
            for (int j = 0; j < A.length; j++) {
                B[i] *= A[j];
            }
            A[i] = temp;
        }
        return B;
    }
}
